package de.hwrberlin.remo.diagram.custom.actions;

import org.apache.log4j.Logger;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;

import de.hwrberlin.remo.diagram.part.ValidateAction;
import de.hwrberlin.remo.diagram.part.ValidationMarker;


public class ValidateModelAction extends AbstractRemoDiagramAction {
	
	@Override
	public void run(IAction action) {
		Logger logger = Logger.getLogger(getClass());
		
		if(action.isChecked()) {
			ValidateAction.runValidation((View) expertSystemEditor.getDiagramEditPart().getModel());
			logger.info("Validating model ... ");
		} else {
			ValidateAction.runValidation((View) expertSystemEditor.getDiagramEditPart().getModel());
			ValidationMarker.removeAllMarkers(expertSystemEditor.getDiagramEditPart().getViewer());
		}
	}

	@Override
	public void selectionChanged(IAction action, ISelection selection) {}
}